<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //Number  String  Boolean Object Null Undefined Array Function

        //while  for  do while   if   switch

        //Number
        var num1 = 100.01
        var num2 = '100.01abc'
        var num3 = 'abc100.01'
        console.log(parseFloat(num1))
        console.log(parseInt(num1))
        console.log(parseFloat(num2))
        console.log(parseInt(num2))
        console.log(parseFloat(num3))
        console.log(parseInt(num3))

        //NaN   not a number

        var num4 = 100.01
        console.log(typeof num4.toString())



        //string    函数/方法

        var str1 = 'abcdefg'
        console.log(str1.length)

        var str2 = '99999asjdajsdka'
        console.log(str1.concat(str2))
        console.log(str1 + str2)

        var str3 = 'auowhanodhfafuawdhfaidhwabxcabe'
        console.log(str3.indexOf('w'))
        console.log(str3.lastIndexOf('w'))


        var str4 = 'asdhjashdjkahciuabsciu'
        str4 = str4.replace('jas', '6')
        console.log(str4)


        var str5 = 'ASDchashdjSdahJSDasd'
        console.log(str5.toUpperCase())
        console.log(str5.toLowerCase())

        var str6 = 'q w e r t y u i o'
        var str7 = 'wd=abc&kkk=456&qqq=789'
        console.log(str6.split(' '))
        console.log(str7.split('&'))


        var str8 = 'asdhjashdjkashdkjahsdiuas'
        console.log(str8.slice(4, 8))  // [4,8)
        //库  数学库

        var num5 = 100
        console.log(Math)
        console.log(Math.abs(-100))  //绝对值
        console.log(Math.ceil(9.0000001))  //
        console.log(Math.floor(9.9999999999999))

        console.log(Math.max(100, 200, 300, 400, 500))
        console.log(Math.min(1, 2, 3, 4, 5, 0))

        console.log(Math.pow(2, 4))
        console.log(Math.pow(10, 3))
        console.log(Math.sqrt(4, 2))
        console.log(Math.random())  //0-1
        //0-20
        console.log(Math.random() * 20)  //0-20
        //5-25 ???
        console.log(Math.random() * 20 + 5)  //5-25



        //
        console.log(Array.isArray('abc'))
        console.log(Array.isArray([1, 2, 3, 4]))

        console.log(Array.of(1, 2, 3, 4, 5, 6, 7, 8, 8))

        console.log(Array.from('abc'))


        var arr1 = [1, 2, 3, 4, 5]
        console.log(arr1.pop())
        console.log(arr1)  //[1,2,3,4]
        console.log(arr1.push(100))
        console.log(arr1)  //[1,2,3,4,100]
        console.log(arr1.shift())
        console.log(arr1) //[2,3,4,100]
        console.log(arr1.unshift(400))
        console.log(arr1)
        //pop 删除数组末尾元素    返回被删除的元素
        //push 数组末尾添加元素        返回添加完成后数组的长度
        //shift 删除数组首位的元素   返回被删除的元素
        //unshift 往数组首位添加元素   返回添加完成后数组的长度

        console.log(arr1.length) // 5

        //往数组任意位置添加或者删除元素？？？

        var arr2 = [1, 2, 3, 4, 5, 6, 7]
        console.log(arr2.splice(2, 3, 100, 200, 300, 400, 500, 600))  //起始位置   长度
        console.log(arr2)

        var arr3 = [1, 2, 3, 4, 5, 6, 7]
        arr3.splice(3, 0, 100)
        console.log(arr3)  //[1,2,3,100,4,5,6,7]

        arr3.splice(5, 1)
        console.log(arr3)


        var arr4 = [1, 2, 3, 4, 5]
        console.log(arr4.reverse())
        console.log(arr4)


        var arr5 = [4, 3, 2, 20, 5, 7, 14, 3, 4, 21, 2, 5, 3]
        arr5.sort(function (a, b) {
            return b - a
        })
        console.log(arr5)


        var arr6 = [1, 2, 3, 4, 5]
        arr6.fill(100, 2, 4)  //[)
        console.log(arr6)


        var arr7 = [1, 2, 3, 4, 5, 6, 7]
        console.log(arr7.slice(3, 5))  //[3,5)
        console.log(arr7)


        var str10 = 'a b c d e f g'
        var arr10 = str10.split(' ')  //['a', 'b', 'c', 'd', 'e', 'f', 'g']

        console.log(arr10.join('-'))  //a-b-c-d-e-f-g


















        function demo(a, b, c, d) {  //形参
            console.log(a, b, c, d)
        }
        demo(100, 200, 300, 400)  //实参 






    </script>
</body>

</html>